#' Online volume clock
#'
#' @param volume_size volume size
#' @param type output type
#'
#' @return a stateful function
#' @export
#'
new_volclk <- function(volume_size, type = c("ohlcv", "vwap"))
{
  type <- match.arg(type)
  mk_aggr_quant_func(volume_size, clk = "volclk", type = type)
}

#' Online turnover clock
#'
#' @param turnover_size turnover size
#' @param type output type
#'
#' @return a stateful function
#' @export
#'
new_tnvrclk <- function(turnover_size, type = c("ohlcv", "vwap"))
{
  type <- match.arg(type)
  mk_aggr_quant_func(turnover_size, clk = "tnvrclk", type = type)
}

#' Online volume bar
#'
#' @param volume_size volume size
#'
#' @return a stateful function
#' @export
#'
new_volume_bar <- function(volume_size)
{
  mk_aggr_bar(volume_size, type = "volume")
}

#' Online turnover bar
#'
#' @param turnover_size turnover size
#'
#' @return a stateful function
#' @export
#'
new_turnover_bar <- function(turnover_size)
{
  mk_aggr_bar(turnover_size, type = "turnover")
}

#' Online tumbling window bar
#'
#' @param window_size window size
#' @param align_window align windows to 00:00:00
#' @param type output type
#' @param itime type of time is ITime
#'
#' @return a stateful function
#' @export
#'
new_tumbling_bar <- function(window_size, align_window = TRUE, type = c("ohlcv", "vwap"), itime = FALSE)
{
  type <- match.arg(type)
  mk_aggr_time_func(window_size, align_window, window = "tumbling", type = type, itime = itime)
}

#' Online sliding window bar
#'
#' @param window_size window size
#' @param type output type
#' @param itime type of time is ITime
#'
#' @return a stateful function
#' @export
#'
new_sliding_bar <- function(window_size, type = c("ohlcv", "vwap"), itime = FALSE)
{
  type <- match.arg(type)
  mk_aggr_time_func(window_size, window = "sliding", type = type, itime = itime)
}
